package com.my.study.redisson.model;

import java.io.Serializable;
import java.util.Objects;

/**
 * 客户端信息
 *
 * @author: yidujun
 * @create: 2021/11/08 15:42
 */
public class ClientInfo implements Serializable {

    private static final long serialVersionUID = -2736703578888265737L;
    private String ip;
    private String port;

    public ClientInfo() {
    }

    public ClientInfo(String ip, String port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ClientInfo that = (ClientInfo) o;
        return Objects.equals(ip, that.ip) &&
                Objects.equals(port, that.port);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ip, port);
    }

    @Override
    public String toString() {
        return ip + ":" + port;
    }
}
